<!doctype html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
	</head>

	<body>
		<!-- 最小的 - video -->
		<video src="./src/1.mp4" controls></video>

		<script>
			// .paused --- 返回视频是否已暂停播放(true/false)
			video.paused;
			// .play() --- 播放、
			video.play();
			// .pause() --- 暂停、
			video.pause();
			// total == 总时长 、 newTime == 当前播放的时长
			var total = video.duration;
			var newTime = video.currentTime;
			// 转化为00:00的格式、
			total = ('00' + parseInt(total / 60)).slice(-2) + ':' + ('00' + parseInt(total % 60)).slice(-2);
			newTime = ('00' + parseInt(newTime / 60)).slice(-2) + ':' + ('00' + parseInt(newTime % 60)).slice(-2);
			// 设置或返回视频中的当前播放位置（以秒计） 需要http
			video.currentTime;

			// 技巧：将总秒数转为00:00的形式、
			var total = '59.002'; // 59.002 总时长(秒)
			parseInt(total / 60); // 0 --- 分
			parseInt(total % 60); // 59 --- 秒
			total = ('00' + parseInt(total / 60)).slice(-2) + ':' + ('00' + parseInt(total % 60)).slice(-2);
			console.log(total); // 00:59

			// video.playbackRate == 设置或返回视频播放的速度。
			video.playbackRate = 1.25;
			// 设置或返回视频的音量 0 ~ 1;
			video.volume = 0.6;

			// 元素全屏的兼容方法、toFullVideo(video_player);
			function exitFullscreen(dom) {
				if (dom.exitFullScreen) {
					dom.exitFullScreen();
				} else if (dom.mozCancelFullScreen) {
					dom.mozCancelFullScreen();
				} else if (dom.webkitExitFullscreen) {
					dom.webkitExitFullscreen();
				} else if (dom.msExitFullscreen) {
					dom.msExitFullscreen();
				}
			}
		</script>
	</body>
</html>
